// ml:run = $bin < input
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <vector>
#include <map>

template <class T>
T abs(T x) { return x > 0 ? x : -x; }

int main()
{
    std::ios::sync_with_stdio(false);
    char a, b;
    long long n;
    std::cin >> a >> b >> n;
    n %= 4;
    std::map<char, long long> m{
        {'v', 0},
        {'<', 1},
        {'^', 2},
        {'>', 3},
    };
    auto ta = m[a];
    auto tb = m[b];

    auto tta = ((ta + n) % 4) == tb;
    auto ttb = (((ta - n) % 4) + 4) % 4 == tb;

    if (tta && ttb) {
        std::cout << "undefined\n";
    } else if (tta) {
        std::cout << "cw\n";
    } else if (ttb) {
        std::cout << "ccw\n";
    }
}

